﻿<?php if(count($comments) > 0):?>
    <ul class="comments-list">
        <?php foreach($comments as $comment):?>
            <li id="comment-<?php echo $comment->comment_id; ?>">
                <div class="comment-header">
					<table>
						<tr>
							<td rowspan="2">
								<img src="/files/default_crea.gif" alt="Creative" height="42" width="42">
							</td>
							<td>
								<?php
									$userName = preg_replace("/('*@*')/", "R", $comment->userName);
									echo $userName;
									echo Yii::app()->dateFormatter->formatDateTime($comment->create_time);
								?>
							</td>
						</tr>
						<tr>
							<td>
							<?php if($this->adminMode === true):?>
							<div class="admin-panel">
								<?php if($comment->status === null || $comment->status == Comment::STATUS_NOT_APPROWED) echo CHtml::link(Yii::t('CommentsModule.msg', 'approve'), Yii::app()->urlManager->createUrl(
									CommentsModule::APPROVE_ACTION_ROUTE, array('id'=>$comment->comment_id)
								), array('class'=>'approve'));?>
								<?php echo CHtml::link(Yii::t('CommentsModule.msg', 'delete'), Yii::app()->urlManager->createUrl(
									CommentsModule::DELETE_ACTION_ROUTE, array('id'=>$comment->comment_id)
								), array('class'=>'delete'));?>
							</div>
							<?php endif; ?>
							<div>
								<?php echo CHtml::encode($comment->comment_text);?>
							</div>
							<?php if(count($comment->childs) > 0 && $this->allowSubcommenting === true) $this->render('ECommentsWidgetComments', array('comments' => $comment->childs));?>
							<?php
								if($this->allowSubcommenting === true && ($this->registeredOnly === false || Yii::app()->user->isGuest === false))
								{
									echo CHtml::link(Yii::t('CommentsModule.msg', 'Add comment'), '#', array('rel'=>$comment->comment_id, 'class'=>'add-comment'));
								}
							?>
							</td>
						</tr>
					</table>
				                    
                </div>
                
            </li>
        <?php endforeach;?>
    </ul>
<?php else:?>
    <p><?php echo Yii::t('CommentsModule.msg', 'Még nem érkezett komment');?></p>
<?php endif; ?>

